<?php
/**
 * 商品模型服务层
 * @author maniac
 */
namespace app\common\service;

use app\common\model\GoodMods AS GoodModsModel;
use app\facade\GoodSpecs;
use app\facade\GoodAttrs;

class GoodMods extends Base
{
    /**
     * 获取商品模型
     * @param  int $good_mods_id 商品模型 id
     */
    public function mod($good_mods_id = 0)
    {
        $info  = GoodModsModel::field('spec_id,attr_id')->where('id', $good_mods_id)->find();
        $specs = $info['spec_id'] ? GoodSpecs::specs($info['spec_id']) : [];
        $attrs = $info['attr_id'] ? GoodAttrs::attrs($info['attr_id']) : [];
        $data  = [
            'specs' => $specs,
            'attrs' => $attrs,
        ];
        return $data;
    }
}
